package com.neusoft.neuiotms.dcam.workflow.controller;


import com.neusoft.bizcore.auth.common.bean.UserBean;
import com.neusoft.bizcore.web.dto.result.ResultDTO;
import com.neusoft.neuiotms.dcam.workflow.dto.ProcessApproveDTO;
import com.neusoft.neuiotms.dcam.workflow.service.ProcessApproveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "流程审批")
@RestController
@RequestMapping(value = "/api/w/workflow/approve")
public class ProcessApproveController {
    @Autowired
    private ProcessApproveService processApproveService;

    @ApiOperation("新增审批")
    @PostMapping
    public ResultDTO<ProcessApproveDTO> create(@RequestBody final ProcessApproveDTO dto,
                                               final UserBean user) {
        return ResultDTO.success(this.processApproveService.create(dto, user));
    }

    @ApiOperation("查看审批")
    @GetMapping("/{workOrderNum}/{taskId}")
    public ResultDTO<ProcessApproveDTO> details(@PathVariable final String workOrderNum,
                                                @PathVariable final String taskId,
                                                final UserBean user) {
        return ResultDTO.success(this.processApproveService.detail(workOrderNum, taskId, user));
    }


}
